#include <string>
#include <vector>

#include "app.hpp"
#include "cv_common.hpp"
#include "orbbec_camera.hpp"

class OrbbecApp : public App {
 private:
  OrbbecCamera camera_;

 public:
  OrbbecApp(const std::string log_path) : App(log_path) {
    camera_.Setup(640, 480);
    camera_.Open(0);

    SPDLOG_WARN("Start Orbbec");
  }

  ~OrbbecApp() {
    camera_.Close();
    SPDLOG_WARN("Stop Orbbec");
  }

  void Run() {
    cv::Mat frame;
    while (true) {
      camera_.GetFrame(frame);

      cv::imshow("show", frame);
      if (' ' == cv::waitKey(10)) {
        cv::waitKey(0);
      }
    }
  }
};

int main(int argc, char const* argv[]) {
  (void)argc;
  (void)argv;

  OrbbecApp app("logs/app.log");
  app.Run();
}